package core.factory;

import core.proxy.TQueueManagerProxy;
import core.proxy.TQueueManagerProxyP2P;
import core.util.COREServiceRegistry;
import org.apache.log4j.Logger;

/**
 * Classe Factory singleton che ritorna l'istanza del Proxy relativo a TQueueManger
 * @author Scuderi Giovanni Luca, Vincenzo Merlo, Paolo Giuffrida
 *
 */
public class TQProxyFactory {

    private final Logger logger = COREServiceRegistry.getLogger(TQProxyFactory.class.toString()); //logger log4j
    private static TQProxyFactory instance = null; // variabile statica per singleton

    /*
     * costruttore per singleton
     */
    private TQProxyFactory() {
        logger.trace("TQProxyFactory");
    }
    

    /**
     * metodo singleton
     * @return istanza del singleton
     */
    public static TQProxyFactory getInstance() {
        if (instance != null) {
            return instance;
        }
        instance = new TQProxyFactory();
        return instance;
    }

    /**
     * Costruisce il proxy per TQueueManager, in particolare ritorna una istanza TQueueManagerProxyP2P
     * @return istanza proxy
     */
    public TQueueManagerProxy getProxy() {
        logger.trace("getProxy");
        return new TQueueManagerProxyP2P();
    }
}
